package com.hk.springbootmybatisplus.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.RequestHandler;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

/**
 * @author by 何坤
 * @Classname MySwagger2Config
 * @Description TODO
 * @Date 2019/9/29 15:08
 */
@Configuration
public class MySwagger2Config {

    private Logger logger = LoggerFactory.getLogger(getClass());
    private boolean enable;

    @Bean
    public Docket docket01(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(myApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.hk.springbootmybatisplus.controller"))
                .paths(PathSelectors.ant("/**"))
                .build()
                .groupName("何坤01");
    }

    @Bean
    public Docket docket02(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("何坤02");
    }

    private ApiInfo myApiInfo(){
        Contact contact = new Contact("何坤", "https://www.cnblogs.com/heixiaoguai/", "hekun.1997@foxmail.com");
        return new ApiInfo("何坤提供的API接口",
                "面对疾风啰",
                "1.0.0",
                "https://www.cnblogs.com/heixiaoguai/",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList()
                );
    }
}
